# Maintainer: Felix Yan <felixonmars@archlinux.org>

pkgname=python-manhole
pkgver=1.8.0
pkgrel=4
arch=('any')
pkgdesc='Debugging manhole for python applications'
license=('BSD')
url='https://github.com/ionelmc/python-manhole'
depends=('python')
makedepends=('python-setuptools')
checkdepends=('python-virtualenv' 'python-pytest-runner' 'python-process-tests' 'python-requests' 'uwsgi')
source=("$pkgname-$pkgver.tar.gz::https://github.com/ionelmc/python-manhole/archive/v$pkgver.tar.gz")
sha512sums=('041452d602895f7ceaafc74ac50713acd470120b022a942946de83f90d2d839ee15b333dfc329f88597b13e0b3fee436af526beae95a3ff94e51376fd2cc27e6')

build() {
  cd "$srcdir"/python-manhole-$pkgver
  python setup.py build
}

check() {
  # Hack to process .pth files properly

  cd "$srcdir"/python-manhole-$pkgver
  virtualenv "$srcdir/pyvenv" --system-site-packages
  (
    . "$srcdir/pyvenv/bin/activate"
    python setup.py develop
    python setup.py pytest
  ) || echo "Tests failed"
}

package() {
  cd python-manhole-$pkgver
  python setup.py install --root "$pkgdir" --optimize=1
  install -D -m644 LICENSE "$pkgdir"/usr/share/licenses/$pkgname/LICENSE
}
